<html>
<head><meta charset="utf-8"><title>integer float bool · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer.20float.20bool.html">integer float bool</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="148652737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer%20float%20bool/near/148652737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer.20float.20bool.html#148652737">(Nov 27 2018 at 17:16)</a>:</h4>
<p><span class="user-mention" data-user-id="126854">@avadacatavra</span> I don't think the overview is worth having, it is not as precise as the sections below, which makes it a bit confusing</p>



<a name="148652783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer%20float%20bool/near/148652783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer.20float.20bool.html#148652783">(Nov 27 2018 at 17:17)</a>:</h4>
<p>I think it is worth having a section for the "fixed-width integer types", you probably want to spell out that i8 maps to <code>int8_t</code>, etc.</p>



<a name="148652883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer%20float%20bool/near/148652883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer.20float.20bool.html#148652883">(Nov 27 2018 at 17:18)</a>:</h4>
<p>I also think that it is worth adding a section for floating point types, in particular, it is worth mentioning that when it comes to Layout, the different revisions of the IEEE standard do not touch it, so it does not make sense to say that they are IEEE754:2008 or IEEE754:2018 compatible, because the layout of the 32 and 64 bit wide floating point types did not change</p>



<a name="148652942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer%20float%20bool/near/148652942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer.20float.20bool.html#148652942">(Nov 27 2018 at 17:19)</a>:</h4>
<p>the section should however mention which of the floating-point formats specified in IEEE754 the <code>f32</code> and <code>f64</code> types have</p>



<a name="148653035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer%20float%20bool/near/148653035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer.20float.20bool.html#148653035">(Nov 27 2018 at 17:20)</a>:</h4>
<p>for <code>f32</code> that's <code>binary32</code> and for <code>f64</code> that's <code>binary64</code></p>



<a name="148653089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer%20float%20bool/near/148653089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/integer.20float.20bool.html#148653089">(Nov 27 2018 at 17:21)</a>:</h4>
<p>I don't know if we should hyperlink wikipedia here, but this link gives an overview: <a href="https://en.wikipedia.org/wiki/IEEE_754#Representation_and_encoding_in_memory" target="_blank" title="https://en.wikipedia.org/wiki/IEEE_754#Representation_and_encoding_in_memory">https://en.wikipedia.org/wiki/IEEE_754#Representation_and_encoding_in_memory</a> (for anything else we can hyperlink the IEEE754:2008 standard or the latest draft of the IEEE754:2018 standard)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>